<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>用户列表</title>
  <link rel="stylesheet" href="/webjars/bootstrap/5.3.3/css/bootstrap.min.css">
</head>
<body>
<h1 th:href="#{page.title}">用户列表</h1>

<div>
  <a href="?lang=en">English</a>
  <a href="?lang=zh">中文</a>
</div>

<a th:href="@{/users/insert}" class="btn btn-primary" th:text="#{button.insert}">新增用户</a>
<table class="table table-striped">
  <thead>
  <tr>
    <th>ID</th>
    <th th:text="#{label.username}">用户名</th>
    <th th:text="#{label.password}">密码</th>
  </tr>
  </thead>
  <tbody>
  <tr th:each="user : ${users}">
    <td th:text="${user.id}"></td>
    <td th:text="${user.username}"></td>
    <td th:text="${user.password}"></td>
    <td>
      <a th:href="@{/users/delete/{id}(id=${user.id})}" class="btn btn-danger" th:text="#{button.delete}">删除</a>
    </td>
  </tr>
  </tbody>
</table>

<script src="/webjars/jquery/3.7.1/jquery.min.js"></script>
<script src="/webjars/bootstrap/5.3.3/js/bootstrap.min.js"></script>
<script src="/webjars/bootstrap/5.3.3/js/bootstrap.bundle.min.js"></script>
</body>
</html>